<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="keyword" content="">

    <title>碰撞报告 - 编制报告</title>

    <!-- Bootstrap core CSS -->
    <link href="__PUBLIC__/css/bootstrap.min.css" rel="stylesheet">
    <link href="__PUBLIC__/css/bootstrap-reset.css" rel="stylesheet">
    <!--external css-->
    <link href="__PUBLIC__/assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <!-- Custom styles for this template -->
    <link href="__PUBLIC__/css/style.css" rel="stylesheet">
    <link href="__PUBLIC__/css/style-responsive.css" rel="stylesheet" />
    <!-- new styles-->
      <link href="__PUBLIC__/css/xxxstyle.css" rel="stylesheet" />
      <link href="__PUBLIC__/css/dropify.min.css" rel="stylesheet" />

      <!-- HTML5 shim and Respond.js IE8 support of HTML5 tooltipss and media queries -->
    <!--[if lt IE 9]>
      <script src="__PUBLIC__/js/html5shiv.js"></script>
      <script src="__PUBLIC__/js/respond.min.js"></script>
    <![endif]-->
  </head>

  <body>
  <section id="container" class="">
      <!--main content start-->
      <section id="main-content">
          <section class="wrapper site-min-height">
              <!-- page start-->
                <form action="__URL__/collision"  enctype="multipart/form-data" method="post" onsubmit="return checkForm(this)" id="xxxFrom">
              <div class="row">
                  <div class="col-sm-12">
                    <div class="tab-content">
                              <div class="panel cReport-fill">
                                  <div class="panel-heading"><i class="icon-file" style="float:left;"></i><span style="float:left;">碰撞报告{$o.id}</span>
                                  	<!-- 主题	 -->
                                     <div style="margin-left:350px;width:200px;">
                                         <select id="themeid" name="themeid" class="selectpicker" data-live-search="true">
                                                  <option value="空">请选择主题</option>
                                            <volist name="theme" id="list">
                                         		  <option value="{$list.id}" <if condition="$o['themeid'] eq $list['id']"> selected="selected"</if>>{$list.name}</option>
                                            </volist>
                                         </select>
                                     </div>
                                     <b type="button"  data-toggle="modal" href="#add_file" style="margin-left:580px;display:block;width:100px;margin-top:-20px;cursor:pointer;"><i class="icon-plus"></i>新增主题</b>
                                  	<!-- 主题结束	 -->
                                  </div>
                               <!-- 此处原为form头 -->
                                  <div class="panel-body">
                                      <div class="form-group">                                        
                                          <label class="col-sm-10 control-label">楼栋号</label>
                                          <div class="col-sm-40">
                                              <input type="text" class="form-control" name="ban" placeholder="" value="{$o.ban}"  required="required"/>
                                          </div>
                                          <label class="col-sm-10 control-label">楼层</label>
                                          <div class="col-sm-40">
                                              <input type="text" class="form-control" name="floor" placeholder="" value="{$o.floor}"  required="required"/>
                                          </div>
                                          
                                      </div>
                                      <div class="form-group">
                                          <label class="col-sm-10 control-label">轴线位置</label>
                                          <div class="col-sm-56">
                                              <div class="input-group">
                                                  <span class="input-group-addon">轴线</span>
                                                  <input type="text" class="form-control tealCenter" name="axis" value="{$o.axis}"  required="required">
                                                  <input type="hidden" value="{$da.id}" name="id" />
                                                  <input type="hidden" value="{$design}" name="design" />
                                                  <input type="hidden" value="{$nail}" name="nail" />
                                                  <span class="input-group-addon">交于</span>

                                                  <input type="text" class="form-control tealCenter" value="{$o.axis_turn}" name="axis_turn" value=""  required="required">
                                                  <span class="input-group-addon">轴线</span>
                                              </div>
                                          </div>
                                          <label class="col-sm-10 control-label">专业</label>
                                          <div class="col-sm-23">
                                              <select class="form-control" name="major">
                                                  <option value="1" <if condition="$o['major'] eq 1"> selected="selected"</if>>结构</option>
                                                  <option value="2" <if condition="$o['major'] eq 2"> selected="selected"</if>>建筑</option>
                                                  <option value="3" <if condition="$o['major'] eq 3"> selected="selected"</if>>暖通</option>
                                                  <option value="4" <if condition="$o['major'] eq 4"> selected="selected"</if>>给排水</option>
                                                  <option value="5" <if condition="$o['major'] eq 5"> selected="selected"</if>>桥架</option>
                                                  <option value="6" <if condition="$o['major'] eq 6"> selected="selected"</if>>弱电</option>
                                                  <option value="7" <if condition="$o['major'] eq 7"> selected="selected"</if>>强电</option>
                                              </select>
                                              <span class="caret"></span>
                                          </div>
                                      </div>
                                      <div class="form-group">
                                        <label class="col-sm-10 control-label">碰撞部位</label>
                                        <div class="col-sm-56">
                                              <div class="input-group">                                                 
                                                  <input type="text" class="form-control tealCenter" name="position"  value="{$o.position}" required="required">                                                 
                                                  <span class="input-group-addon">与</span>
                                                  <input type="text" class="form-control tealCenter" name="position_turn"  value="{$o.position_turn}" required="required">
                                                  <span class="input-group-addon">碰撞</span>
                                              </div>
                                        </div>
                                        <label class="col-sm-10 control-label">优化点</label>
                                        <div class="col-sm-23">
                                              <select class="form-control" name="optimization">
                                                  <option value="1" <if condition="$o['optimization'] eq 1"> selected="selected"</if>>设计改善</option>
                                                  <option value="2" <if condition="$o['optimization'] eq 2"> selected="selected"</if>>运维优化</option>
                                                  <option value="3" <if condition="$o['optimization'] eq 3"> selected="selected"</if>>降低验收风险</option>
                                                  <option value="4" <if condition="$o['optimization'] eq 4"> selected="selected"</if>>施工便利性</option>
                                                  <option value="5" <if condition="$o['optimization'] eq 5"> selected="selected"</if>>优化工期</option>
                                                  <option value="6" <if condition="$o['optimization'] eq 6"> selected="selected"</if>>优化成本</option>                                                
                                              </select>
                                              <span class="caret"></span>
                                        </div>
                                      </div>
                                      <div class="form-group">                                        
                                          <label class="col-sm-10 control-label">造价</label>
                                          <div class="col-sm-40">
                                              <div class="input-group">
                                                  <span class="input-group-addon">¥</span>
                                                  <input type="text" class="form-control" name="cost" value="{$o.cost}" placeholder="选填，+ 代表节约，- 代表增加">
                                                  <span class="input-group-addon">万元</span>
                                                  <!-- onkeyup="this.value=this.value.replace(/\D/g,'')"  onafterpaste="this.value=this.value.replace(/\D/g,'')" -->
                                              </div>
                                          </div>
                                          <label class="col-sm-10 control-label">工期</label>
                                          <div class="col-sm-40">
                                              <div class="input-group">
                                                  <input type="text" class="form-control" name="time_limit" value="{$o.time_limit}" placeholder="选填，+ 代表节约，- 代表增加">
                                                  <span class="input-group-addon">天</span>
                                              </div>
                                          </div>
                                      </div>									 
                                       <if condition="$o neq '' && $o['status'] neq 1">
                                      <br>
                                      <div style="text-align:center"><span style="color:red">注:重新编制报告时,如图片无需修改,可以不用上传</span></div>
                                      <br>
                                      </if>
                                      <div class="form-group pb20">
                                          <label class="col-sm-10 control-label">BIM模型图</label>
                                          <!--new-->
                                          <div class="radios picPos">
                                              <label class="label_radio" for="PicSelect-1">
                                                  <input name="picsel" id="PicSelect-1" value="1" type="radio" checked />
                                                  <img src="__PUBLIC__/images/checkbox/SelectPic1.png" />
                                              </label>
                                              <label class="label_radio" for="PicSelect-2">
                                                  <input name="picsel" id="PicSelect-2" value="2" type="radio" <if condition="$o['imgtype'] eq 2">checked</if>/>
                                                  <img src="__PUBLIC__/images/checkbox/SelectPic2.png" />
                                              </label>
                                          </div>
                                           <div class="selectTwoPic" <if condition="$o['imgtype'] eq 2">style="display:none;"</if>>
                                             <div class="col-sm-44 pzBIM">
                                                 <label>原图</label>
                                                 <input type="file" id="original" class="dropify-fr"  name="file1" data-height="390" did="{$o.imgtype}" data-max-file-size="2M" data-allowed-file-extensions="png jpg jpeg gif bmp pdf psd" data-default-file="{$o.original}"/>
                                             </div>
                                             <div class="col-sm-44 pzBIM selBIM">
                                                 <label for="input-file-pzImg">更正后</label>
                                                 <input type="file" id="original_edit" class="dropify-fr"  name="file2" data-height="390" data-max-file-size="2M" data-allowed-file-extensions="png jpg jpeg gif bmp pdf psd" data-default-file="{$o.original_edit}"/>
                                             </div>
                                         	</div>
                                          <div class="col-sm-90 pzBIM selectOnePic" <if condition="$o['imgtype'] eq 2">style="display:block;"</if>>
                                              <label>对比图</label>
                                              <input type="file" id="oimg" class="dropify-fr"  name="file3" data-height="390" did="{$o.imgtype}" data-max-file-size="2M" data-allowed-file-extensions="png jpg jpeg gif bmp pdf psd" data-default-file="{$o.oimg}"/>
                                          </div>
                                      </div>
                                      <div class="form-group">
                                          <label class="col-sm-10 control-label">问题描述</label>
                                          <div class="col-sm-90">
                                              <textarea class="form-control error" rows="4" name="problem" required="" value=""  required="required"/>{$o.problem|json_decode}</textarea>
                                          </div>
                                      </div>
                                      <div class="form-group">
                                          <label class="col-sm-10 control-label">建议方案</label>
                                          <div class="col-sm-90">
                                              <textarea class="form-control error" rows="4" name="proposal" required="" value=""  required="required"/>{$o.problem|json_decode}</textarea>
                                          </div>
                                      </div>
                                       <if condition="$da['status'] eq 2 || $da['status'] eq 6 && $reject neq ''">
                                        <foreach name="reject" item="v" key="k">
    	                                     <div class="form-group paddingA">
    	                                          <div class="collisionReport-table cRtableM15">
    	                                              <div class="cRtable-row">
    	                                                  <div class="cRow-9 cRtable-bg cRowQ" style="background:#808696;">
                                                          <span class="pull-left">驳回意见</span>
                                                          <span class="pull-right">
                                                              <span><i class="glyphicon glyphicon-user"></i>{$v.name}</span>
                                                              <span><i class="glyphicon glyphicon-time"></i>{$v.add_time|date='Y-m-d H:i',###}</span>  
                                                          </span>
                                                        </div>
    	                                              </div>
    	                                              <div class="cRtable-row">
    	                                                  <div class="cRow-9 cRowY">{$v.yj|json_decode} </div>
    	                                              </div>
    	                                          </div>
    	                                     </div>
	                                     </foreach>
                                     </if>
                                       <if condition="$o['status'] neq 2 && $o['status'] neq 6">
	                                      <div class="cReport-btn pr5">
	                                          <button class="btn btn-submit" type="submit" onclick="draft()" id="ed" style="background:#4C9689">保存为草稿</button>
	                                      </div>
                                      </if>
                                      <div class="cReport-btn pr5">
                                          <button class="btn btn-submit" type="submit" id="tj">提交</button>
                                      </div>
                              </div>
                            
                                              
                    </div> 
                  </div>
                  </div>
              </div>
               </form>
              <!-- page end-->
          </section>
      </section>
      <!--main content end-->
  </section>
  
    <!--新增主题（Modal） -->
    <div class="modal fade" id="add_file" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
         <div class="modal-dialog">
             <div class="modal-content">
                 <div class="modal-header">
                     <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                     <h4 class="modal-title">新增主题</h4>
                 </div>
                     <div class="modal-body">
                      <div class="form-group">
                         <label class="col-sm-3 control-label">主题名称</label>
                         <div class="col-sm-9">
                             <input type="text" class="form-control" value="" id="theme" maxlength="16">
                         </div>
                     </div>
                    </div>
                 <div class="modal-footer">
                     <button data-dismiss="modal" class="btn btn-default" type="button">取消</button>
                     <button class="btn btn-submit" type="button" onclick="theme()">新增</button>
                 </div>
             </div>
         </div>
     </div>

    <!-- js placed at the end of the document so the pages load faster -->
    <script src="__PUBLIC__/js/jquery.js"></script>
    <script src="__PUBLIC__/js/jquery-1.8.3.min.js"></script>
    <script src="__PUBLIC__/js/bootstrap.min.js"></script>
    <script class="include" type="text/javascript" src="__PUBLIC__/js/jquery.dcjqaccordion.2.7.js"></script>
    <script src="__PUBLIC__/js/jquery.scrollTo.min.js"></script>
    <script src="__PUBLIC__/js/jquery.nicescroll.js" type="text/javascript"></script>
    <script src="__PUBLIC__/js/jquery.customSelect.min.js" ></script>
    
    <!--common script for all pages-->
    <script src="__PUBLIC__/js/common-scripts.js"></script>

    <!--new script for this page only-->
    <script src="__PUBLIC__/js/common-singlePage.js"></script> 
    <script src="__PUBLIC__/js/dropify.min.js"></script>
    <script src="__PUBLIC__/js/bootstrap-select.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/layer/layer.js"></script>
    <script>
      $(document).ready(function(){
          var drEvent = $('.dropify-fr').dropify({
              messages: {
                  default: '将图片拖放到此处或单击',
                  replace: '拖放或单击以替换',
                  remove:  '移除',
                  error:  '发生错误'
              },
              error: {
                  'fileExtension': '上传文件格式需为 {{ value }}。',
                  'fileSize': '上传文件大小最大为 {{ value }}。'
              }
          });
          drEvent.on('dropify.beforeClear', function(event, element){
              return confirm("你确定要删除 \"" + element.file.name + "\" 吗？");
          });
          drEvent.on('dropify.afterClear', function(event, element){
              alert('删除成功。');
          });
          drEvent.on('dropify.errors', function(event, element){
              console.log('Has Errors');
          });
      });
      //提交判断
      function checkForm(o){  
    		  var did = $('#original').attr('did');
    		  var did1 = $('#oimg').attr('did');
    		  var them = $('#themeid option:selected').val();
    		  if(them=='空' || them==null){
    			  layer.msg('请选择主题',{icon:2});
    			  return false;
    		  }
    		  if($('#PicSelect-1').is(':checked')) {
    			  if(did == '' || did == 0){
	        		  var de1 = $('#original').val();
	        		  var de2 = $('#original_edit').val();
	        		  if(de1==''){
	        			  layer.msg('请上传原图',{icon:2});
	        			  return false;
	        		  }
	        		  if(de2==''){
	        			  layer.msg('请上传更正后的图',{icon:2});
	        			  return false;
	        		  }
    			  }
    		  }
    		  if($('#PicSelect-2').is(':checked')){
	    			if(did == '' || did == 0){
	        		  var de = $('#oimg').val();
	        		  if(de==''){
	        			  layer.msg('请上传对比图',{icon:2});
	        			  return false;
	        		  }
	    			}
    		  }
    		  var action =  document.forms.xxxFrom.action;
    		  if(action.slice(-13) == 'editcollision'){
    			  $('#ed').attr('disabled',true);
        		  $('#ed').text('正在保存中……');
    		  }else{
    			  $('#tj').attr('disabled',true);
        		  $('#tj').text('正在提交中……');
    		  }
     }
     //保存草稿判断
     function draft(){
    	 document.forms.xxxFrom.action="__URL__/editcollision";
    	// document.forms.xxxFrom.submit();
     }
     
     //新增主题
     	function theme(){
   		 var name = $("#theme").val();
    	 if(name==''){
	   		  layer.msg('主题名称不能为空',{icon:2});
	   		  return;
      	  }
	    	  $.ajax({
			 		type : 'post',
			 		url : '__URL__/add_theme',
			 		data : {name:name},
			 		dataType : 'json',
			 		success : function(res){
			 			 if(res.status==0){
							layer.alert(res.info, {icon: 2});
							return;
						 }
			 			 if(!res.errNo){
			 				 $("#themeid").prepend("<option value='" + res.data.id + "'> " + res.data.name + " </option>");   
			 				 $("#themeid").selectpicker('refresh');
			 				 layer.msg(res.msg,{icon:1});
			 				 $('#add_file').modal('hide');
				          }else{
				        	 layer.msg(res.msg,{icon:2});
				          }
			 		}
		     })
	    }
  </script>
  </body>
</html>
